package com.v.im.businessservice.bean;

import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Objects;

@Entity
@Table(name = "im_chat_group_user", schema = "im", catalog = "")
@IdClass(ImChatGroupUserEntityPK.class)
public class ImChatGroupUserEntity {
    private String chatGroupId;
    private String userId;
    private Timestamp createDate;

    @Id
    @Column(name = "chat_group_id")
    public String getChatGroupId() {
        return chatGroupId;
    }

    public void setChatGroupId(String chatGroupId) {
        this.chatGroupId = chatGroupId;
    }

    @Id
    @Column(name = "user_id")
    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    @Basic
    @Column(name = "create_date")
    public Timestamp getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Timestamp createDate) {
        this.createDate = createDate;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        ImChatGroupUserEntity that = (ImChatGroupUserEntity) o;
        return Objects.equals(chatGroupId, that.chatGroupId) &&
                Objects.equals(userId, that.userId) &&
                Objects.equals(createDate, that.createDate);
    }

    @Override
    public int hashCode() {
        return Objects.hash(chatGroupId, userId, createDate);
    }
}
